#include<bits/stdc++.h>
#define ll long long
#define L x<<1
#define R x<<1|1
#define mid (l+r>>1)
#define lc L,l,mid
#define rc R,mid+1,r
#define OK Ll<=l&&r<=Rr
#define Root 1,1,n
#define rep(x,y,z) for(int x=(y);x<=(z);x++)
#define per(x,y,z) for(int x=(y);x>=(z);x--)
#define repn(x) rep(x,1,n)
#define repm(x) rep(x,1,m)
#define pb push_back
#define e(x) for(int i=h[x],y=to[i];i;i=nxt[i],y=to[i])
#define E(x) for(auto y:p[x])
#define Pi pair<int,int>
#define ui unsigned ll
inline int read(){int s=0,w=1;char c=getchar();while(c<48||c>57) {if(c=='-') w=-1;c=getchar();}while(c>=48&&c<=57)s=(s<<1)+(s<<3)+c-48,c=getchar();return s*w;}
inline void pf(int x){if(x<0) putchar('-'),x=-x;if(x>9)pf(x/10);putchar(x%10+48);}
using namespace std;
const int N=2e5+10,M=1e7+5,inf=1e9,mod=998244353;
const ll llf=1e18;
inline void add(int &a,int b){((a+=b)>=mod) and (a-=mod);}
inline int Add(int a,int b){return add(a,b),a;}
inline int mul(int a,int b){return 1LL*a*b%mod;}
inline void Mul(int &a,int b){a=mul(a,b);}
inline void red(int &a,int b){add(a,mod-b);}
inline int Red(int a,int b){return red(a,b),a;}
inline int qp(int a,int b){if(!b)return 1;int c=qp(a,b>>1);Mul(c,c);if(b&1)Mul(c,a);return c;}
inline int INV(int x){return qp(x,mod-2);}
int n,a[N],b[N];
int ans[N];
inline void subtask1(){
	repn(i)ans[i]=inf;
	repn(l){
		int ma=a[l],mb=b[l];
		rep(r,l,n){
			ma=min(ma,a[r]),mb=min(mb,b[r]);
			ans[r-l+1]=min(ans[r-l+1],abs(ma-mb));
		}
	}
	repn(i)cout <<ans[i]<<'\n';
}
inline void subtaskA(){
	int ans=inf;
	repn(i)ans=min(ans,a[i]);
	repn(i)cout <<ans-1<<'\n';
}
int f[N],siz[N],Mx,lsh[N],d[N],m;
inline int find(int x){
	return f[x]==x?x:f[x]=find(f[x]);
}
bool v[N];
inline void merge(int x,int y){
	x=find(x),y=find(y);
	if(x==y)return;
	f[x]=y,siz[y]+=siz[x],Mx=max(Mx,siz[y]);
}
vector<int>p[N];
inline void insert(int p){
	v[p]=1;
	if(v[p-1])merge(p,p-1);
	if(v[p+1])merge(p,p+1);
}
inline void subtaskB(){
	repn(i)lsh[i]=a[i],f[i]=i,siz[i]=1;Mx=1;
	sort(lsh+1,lsh+n+1);
	repn(i)if(lsh[i]^lsh[i+1])d[++m]=lsh[i];
	repn(i)a[i]=lower_bound(d+1,d+m+1,a[i])-d,p[a[i]].pb(i);
	per(i,m,1){
		E(i)insert(y);
		if(!ans[Mx])ans[Mx]=i;
	}
	Mx=0;
	per(i,n,1){
		Mx=max(Mx,ans[i]);
		ans[i]=Mx;
	}
	repn(i)cout <<inf-d[ans[i]]<<'\n';
}
inline void Main(){
	n=read();
	repn(i)a[i]=read();
	repn(i)b[i]=read();
	if(n<=1000)return subtask1(),void();
	bool subA=1,subB=1;
	repn(i)subA&=b[i]==1,subB&=b[i]==inf;
	if(subA)return subtaskA(),void();
	if(subB)return subtaskB(),void();
}
signed main(){
	freopen("min.in","r",stdin);
	freopen("min.out","w",stdout);
	int T=1;
	while(T--)Main();
	return 0;
}